home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / DOS / DOS47.C < prev    next >
C/C++ Source or Header  |  1994-12-17  |  436b  |  27 lines

  1. #include <errno.h>
  2. #include <sys/doscalls.h>
  3.  
  4. /*
  5. ** AH = 0x47
  6. ** DS:SI name
  7. */
  8. int dos_getcwd(unsigned char drive, char *name)
  9. {
  10.     struct REGPACK r;
  11.     struct SEGPACK sr = { GetDS(), GetES()};
  12.  
  13.     r.eax = 0x4700;
  14.     r.edx = drive;
  15.  
  16.     SET_SEG_OFF(name, sr.ds, r.esi);
  17.  
  18.     _intxr(0x21, &r, &sr);
  19.  
  20.     if (r.eflags & 1) {
  21.     _sys_doserror2errno( r.eax & 0xFFFF);
  22.     return (-1);
  23.     }
  24.     else
  25.     return (0);
  26. }
  27.